<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta content="text/javascript" http-equiv="content-script-type">
<title>tango.net.cluster.tina.ProtocolWriter</title>

<link rel="stylesheet" type="text/css" href="css/style.css">
<!--[if lt IE 7]><link rel="stylesheet" type="text/css" href="css/ie56hack.css"><![endif]-->
<script language="JavaScript" src="js/util.js" type="text/javascript"></script>
<script language="JavaScript" src="js/tree.js" type="text/javascript"></script>
<script language="JavaScript" src="js/explorer.js" type="text/javascript"></script>
<script>
function anchorFromTitle(title, path, ext) {
  var url = path + title + "." + ext;
  document.write("<a href='" + url + "'>" + title + "</a>");
  }
</script>
</head><body>
<div id="tabarea"></div><div id="explorerclient"></div>
<div id="content"><script>explorer.initialize("tango.net.cluster.tina.ProtocolWriter");</script>
        <table class="content">
                <tr><td id="docbody"><h1><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/cluster/tina/ProtocolWriter.d?rev=3327">tango.net.cluster.tina.ProtocolWriter</a></h1>
                
<b>License:</b><br>
BSD style: see <a href="http://www.dsource.org/projects/tango/wiki/LibraryLicense">license.txt</a><br><br>
<b>Version:</b><br>
July 2004: Initial release<br><br>
<b>author:</b><br>Kris<br><br>
<script>explorer.outline.incSymbolLevel();</script>
<dl>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>class <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/cluster/tina/ProtocolWriter.d?rev=3327#L44">ProtocolWriter</a></span>
<script>explorer.outline.addDecl('ProtocolWriter');</script>;</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Objects passed around a cluster are prefixed with a header, so the 
        receiver can pick them apart correctly. This header consists of:
        <pre class="d_code">

 <span class="i">the</span> <span class="i">packet</span> <span class="i">size</span>, <span class="i">including</span> <span class="i">the</span> <span class="i">header</span> (<span class="n">16</span> <span class="i">bits</span>)
 <span class="i">a</span> <span class="i">command</span> <span class="i">code</span> (<span class="n">8</span> <span class="i">bits</span>)
 <span class="i">a</span> <span class="k">version</span> <span class="i">id</span> (<span class="n">8</span> <span class="i">bits</span>)
 <span class="i">a</span> <span class="i">timestamp</span> (<span class="n">64</span> <span class="i">bits</span>)
 <span class="i">length</span> <span class="i">of</span> <span class="i">the</span> <span class="i">channel</span> <span class="i">name</span> (<span class="n">32</span> <span class="i">bits</span>)
 <span class="i">the</span> <span class="i">channel</span> <span class="i">name</span>
 <span class="i">length</span> <span class="i">of</span> <span class="i">the</span> <span class="i">key</span> (<span class="n">32</span> <span class="i">bits</span>)
 <span class="i">the</span> <span class="i">key</span>
 <span class="i">an</span> <span class="i">optional</span> <span class="i">payload</span> (<span class="i">an</span> <span class="i">IMessage</span> <span class="i">instance</span>)
        
</pre></font><br><br>
<font color="black">Everything is written in Network order &#40;big endian&#41;<br><br></font><br><br>
<script>explorer.outline.incSymbolLevel();</script>
<dl>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>enum <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/cluster/tina/ProtocolWriter.d?rev=3327#L57">Command</a></span>
<script>explorer.outline.addDecl('Command');</script>;</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">protocol commands</font><br><br>
</dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li><span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/cluster/tina/ProtocolWriter.d?rev=3327#L83">this</a></span>
<script>explorer.outline.addDecl('this');</script>(IBuffer <span class="funcparam">buffer</span>);</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Construct a ProtocolWriter upon the given buffer. As
                Objects are serialized, their content is written to this
                buffer. The buffer content is then typically flushed to 
                some external conduit, such as a file or socket.</font><br><br>
<font color="black">Note that serialized data is always in Network order.<br><br></font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>ProtocolWriter <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/cluster/tina/ProtocolWriter.d?rev=3327#L100">put</a></span>
<script>explorer.outline.addDecl('put');</script>(Command <span class="funcparam">cmd</span>, char[] <span class="funcparam">channel</span>, char[] <span class="funcparam">element</span> = null, IMessage <span class="funcparam">msg</span> = null);</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Stuff the request into our output buffer. Note that this
                protocol is prefixed by a 'size' value, requiring that
                all messages can be contained within the buffer. This is
                not considered a serious limitation, as the messages are
                not intended to be "large" given that they're traversing 
                the network.</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>ProtocolWriter <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/cluster/tina/ProtocolWriter.d?rev=3327#L132">reply</a></span>
<script>explorer.outline.addDecl('reply');</script>(ClusterContent <span class="funcparam">content</span>);</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Emit a ClusterContent constructed by ProtocolReader.getPacket</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>ProtocolWriter <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/cluster/tina/ProtocolWriter.d?rev=3327#L161">exception</a></span>
<script>explorer.outline.addDecl('exception');</script>(char[] <span class="funcparam">message</span>);</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Write an exception message</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>ProtocolWriter <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/cluster/tina/ProtocolWriter.d?rev=3327#L172">success</a></span>
<script>explorer.outline.addDecl('success');</script>(char[] <span class="funcparam">message</span> = null);</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Write an "OK" confirmation</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>ProtocolWriter <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/cluster/tina/ProtocolWriter.d?rev=3327#L183">full</a></span>
<script>explorer.outline.addDecl('full');</script>(char[] <span class="funcparam">message</span>);</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Indicate something has filled up</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>void <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/net/cluster/tina/ProtocolWriter.d?rev=3327#L194">flush</a></span>
<script>explorer.outline.addDecl('flush');</script>();</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Flush the output
        
</font><br><br></dd></dl>
<script>explorer.outline.decSymbolLevel();</script></dd></dl>
<script>explorer.outline.decSymbolLevel();</script></td></tr>
                <tr><td id="docfooter">
                        Copyright (c) 2004 Kris Bell. All rights reserved :: page rendered by CandyDoc. Generated by <a href="http://code.google.com/p/dil">dil</a> on Tue Mar  4 22:45:32 2008.
                </td></tr>
        </table>
</div>
<script></script>
</body></html>